package com.example.administrator.im.utils;

import com.example.administrator.im.MyApplication;

import java.io.File;

/**
 * create:2018/11/12 16:42
 * author: 姚鸿杰
 **/
public class FileUtils {

    public static String USER_PACK = "userHeadImage";
    public static String FRIEND_PACK = "friendHeadImage";
    public static String CHAT_ROOM_PACK = "chatRoomImage";

    public static File getFilePath(String url, String pack) {

        String imageName = url;
        if (CHAT_ROOM_PACK.equals(pack)) {
            String[] split = url.split("/");
            imageName = split[split.length - 1];
        }

        String filePath = MyApplication.getmContext().getExternalCacheDir() + File.separator + pack;
        String fileName = imageName + ".png";
        return new File(filePath, fileName);
    }


}
